import api from './api'

class OrderApi extends api {
  produce (orderId) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/produce/${orderId}`,
      method: 'put'
    })
  }

  delivery (orderId) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/delivery/${orderId}`,
      method: 'put'
    })
  }

  cancel (orderId, remark) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/cancel/${orderId}`,
      method: 'put',
      data: { remark }
    })
  }

  done (orderId) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/done/${orderId}`,
      method: 'put'
    })
  }

  addTask (orderId, data) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/task/${orderId}`,
      method: 'post',
      data
    })
  }
}

export default new OrderApi('platform/order')
